﻿using System;
using System.Collections.Generic;
using System.Text;

namespace AdvanceLib.UI
{
    public class Animation
    {
        #region Constructors
        public Animation()
        {
            this.Direction = AnimationDirection.Increment;
        }
        public Animation(int duration)
        {
            this.Duration = duration;
        }
        public Animation(int duration, int frameRate) : this(duration)
        {
            this.Duration = duration;
            this._frameRate = frameRate;
        }
        #endregion

        #region Fields
        private int _frameRate = 50;
        #endregion

        #region Properties
        public int Duration
        {
            get; set;
        }
        public AnimationDirection Direction
        {
            get; set;
        }
        public int FrameRate
        {
            get { return Math.Max(_frameRate, 1); }
            set { _frameRate = value; }
        }
        public float Value
        {
            get; set;
        }
        #endregion

        #region Methods
        public void Reset()
        {
            switch (this.Direction)
            {
                case AnimationDirection.Increment:
                    this.Value = 0.0f;
                    break;
                case AnimationDirection.Decrement:
                    this.Value = 1.0f;
                    break;
            }
        }
        #endregion
    }
    public enum AnimationDirection
    {
        Increment = 0,
        Decrement = 1
    }
}
